<?php

namespace App\Admin\Controllers;

use App\Http\Controllers\Controller;
use App\Models\StoreDetail;
use Encore\Admin\Controllers\Dashboard;
use Encore\Admin\Facades\Admin;
use Encore\Admin\Layout\Column;
use Encore\Admin\Layout\Content;
use Encore\Admin\Layout\Row;
use Illuminate\Support\Facades\Route;

class HomeController extends Controller
{
    public function index(Content $content)
    {
        return $content
            ->title('Dashboard')
            ->description('Description...')
            ->row(Dashboard::title())
            ->row(function (Row $row) {

                $row->column(4, function (Column $column) {
                    $column->append(Dashboard::environment());
                });

                $row->column(4, function (Column $column) {
                    $column->append(Dashboard::extensions());
                });

                $row->column(4, function (Column $column) {
                    $column->append(Dashboard::dependencies());
                });
            });
    }

    public function storeDetail(Content $content)
    {
    	//dd(Route::currentRouteName());
            $store_id = Admin::user()->store_id;
            $store = StoreDetail::where('store_id', $store_id)->first();
            return $content
                ->title('欢迎登录')
                ->body(view('welcome', ['store' => $store]));
            
        //return redirect()->route('orders.index');
    }
}
